package com.wzh.bargain.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.wzh.bargain.entity.BarLogEntity;
import com.wzh.bargain.service.BarLogService;
import com.wzh.common.utils.PageUtils;
import com.wzh.common.utils.R;



/**
 * 
 *
 * @author wzh
 * @email 1281204121@qq.com
 * @date 2022-03-08 16:12:49
 */
@RestController
@RequestMapping("bargain/barlog")
public class BarLogController {
    @Autowired
    private BarLogService barLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = barLogService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{barLogId}")
    public R info(@PathVariable("barLogId") Integer barLogId){
		BarLogEntity barLog = barLogService.getById(barLogId);

        return R.ok().put("barLog", barLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody BarLogEntity barLog){
		barLogService.save(barLog);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody BarLogEntity barLog){
		barLogService.updateById(barLog);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] barLogIds){
		barLogService.removeByIds(Arrays.asList(barLogIds));

        return R.ok();
    }

}
